//Memtests

#include "kernel.h"
#include "kernel_hwdep.h"
#include "mem_malloc.h"

void dummyTask()
{
  terminate();
}

void testTask()
{
  int mem = 0;
  int mem2 = 0;
  double* a;
  //Test memory function
  mem = getAllocated();
  a = malloc(sizeof(int));
  free(a);
  mem2 = getAllocated();
  if(mem != mem2) terminate(); //FAIL
  
  mem = getAllocated();
  create_task(dummyTask, 101);
  SaveContext();
  set_deadline(102);
  mem2 = getAllocated();
  if(mem == mem2)
    terminate(); //Pass
  else 
    while(1); //FAIL
}

void memTests()
{
  init_kernel();
  
  create_task( testTask, 100 );
  run();
}